﻿define("ow-epi-imageProperty/widgets/ImageOverlayType", [
// Dojo
        "dojo/_base/declare",
        "dojo/_base/lang",
// EPi Framework
        "epi/string",
        "epi-cms/widget/overlay/Property"
    
    ],
    function (
    // Dojo
        declare,
        lang,
    // EPi Framework
        epiString,
        Property
    ) {
        return declare("ow-epi-imageProperty.widgets.ImageOverlayType", [Property], {
            
            postMixInProperties: function () {
                // summary:
                //      Create the view model if it doesn't exist.
                // tags:
                //      protected

                this.inherited(arguments);
                if (this.supportedMediaTypes) {
                    this.allowedDndTypes = this.allowedDndTypes || this.supportedMediaTypes;
                }
                
            },

            onValueChange: function (values/* Array || object*/) {
                // summary:
                //      Event to notify that this and possibly other properties
                //      has changed their values
                // values: Object  ||[Object]
                //      The property values that has changed. {propertyName: "propertyName", value: value}
                // tags:
                //      Public callback
            },

            onDrop: function (target, dndData) {
                var value = dndData.contentLink;
                // If we have a mapping dropdata to child property
                // then set drop data to this
                // REMARK: This's just a simple case, handling one specified property, this doesn't support recursive or duplicate child property
                var propertyName = this._getRightProperty();
                this.onValueChange({
                    propertyName: propertyName,
                    value: value
                });
            }
        });
    });
